--#include "data\functions\common\CommonItemOp.lua" once

local npcId = 153
NpcDialog[npcId] = {}
local t = NpcDialog[npcId]

t.main = function(sysarg)
	local strCond		= Lang.ScriptTips.Cross001
	local strDesc 		= Lang.ScriptTips.Cross002
	local okBtn1 		= "{btn;0;".. Lang.ScriptTips.CrossButton03 ..";%s;}"			--{按钮;样式;按钮名;函数名;描述}
	local okBtn2 		= "{btn;0;".. Lang.ScriptTips.CrossButton04 ..";%s;}"			--{按钮;样式;按钮名;函数名;描述}
	local strBtnList 	= string.format(okBtn1, "CrossRecycleDigItem")
	strBtnList 	= strBtnList..string.format(okBtn2, "CrossRecycleDigItemBind")

	local pack = DataPack.allocPacket(sysarg, LogicCmd.npcDialogSys.sysID, LogicCmd.npcDialogSys.sub.sNpcDlgData)
	DataPack.writeUint64(pack, Actor.getNpc(sysarg))
	DataPack.writeByte(pack, NpcDialogType.GeneralNpcDlg)
	DataPack.writeString(pack, strCond)
	DataPack.writeString(pack, strDesc)
	DataPack.writeString(pack, strBtnList)
	DataPack.writeChar(pack, -1)
	DataPack.writeByte(pack, 0);
	DataPack.flush(pack)
end

--[[
回收金锄头（非绑）
]]
t.CrossRecycleDigItem = function(sysarg)
	local recycleIdx = 1
	if CommonRecycleByIdx( sysarg, recycleIdx, GameLog.clDigBossItemRecycleDel, Lang.ScriptTips.CrossLog01, 
		GameLog.clDigBossItemRecycleAdd, Lang.ScriptTips.CrossLog02, true ) then
		Actor.sendTipmsg(sysarg, Lang.ScriptTips.Cross003, ttChatWindow+ttFlyTip)
	end
end

--[[
回收金锄头（绑定）
]]
t.CrossRecycleDigItemBind = function(sysarg)
	local itemCount = Actor.getItemCount( sysarg, 1049, 0, -1, 1 )
	if itemCount < 1 then
		Actor.sendTipmsg(sysarg, Lang.ScriptTips.Cross005, ttFlyTip)
		return
	end

	local recycleIdx = 2
	if CommonRecycleByIdx( sysarg, recycleIdx, GameLog.clDigBossItemRecycleDel, Lang.ScriptTips.CrossLog03, 
		GameLog.clDigBossItemRecycleAdd, Lang.ScriptTips.CrossLog04, true ) then
		Actor.sendTipmsg(sysarg, Lang.ScriptTips.Cross004, ttChatWindow+ttFlyTip)
	end
end


